package joodle.ui;
/**
 * Represents the action for "CreatorTools" component
 */
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;

import joodle.domain.ShapeFactory;
import joodle.tools.CreatorTool;

@SuppressWarnings("serial")
public class ShapeCreatorAction extends AbstractAction {
	final ShapeFactory factory;
	static final String iconPath = "icons/";
	
	public ShapeCreatorAction(ShapeFactory factory) {
		putValue(Action.SMALL_ICON, factory.shapeIcon());
		putValue(Action.SHORT_DESCRIPTION, factory.shapeName());
		this.factory = factory;
	}
	/**
	 * @see AbstractAction#actionPerformed(ActionEvent)
	 */
	@Override
	public void actionPerformed(ActionEvent ae) {
		CanvasComponent.instance().setTool(new CreatorTool(factory));
	}
}
